package niu.modao.modao;

import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.RadioGroup;
import java.util.ArrayList;
import java.util.List;

import niu.modao.maodao.R;
import niu.modao.modao.fragment.CenterFragment;
import niu.modao.modao.fragment.MeFragment;
import niu.modao.modao.fragment.OrderFragment;
import niu.modao.modao.fragment.ToolsFragment;
import niu.modao.modao.utils.FragmentTabUtils;

public class MainActivity extends AppCompatActivity implements FragmentTabUtils.OnRgsExtraCheckedChangedListener {
    private List<Fragment> fragments;
    private RadioGroup rgps;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        rgps = (RadioGroup) findViewById(R.id.rg_main_footers);
        fragments = new ArrayList<>();
        fragments.add(OrderFragment.getInstance());
        fragments.add(CenterFragment.getInstance());
        fragments.add(ToolsFragment.getInstance());
        fragments.add(MeFragment.getInstance());
        FragmentTabUtils utils = new FragmentTabUtils(getSupportFragmentManager(), fragments, R.id.fl_main_container, rgps);
        utils.setOnRgsExtraCheckedChangedListener(this);
    }

    @Override
    public void OnRgsExtraCheckedChanged(RadioGroup radioGroup, int checkedId, int index) {

    }
}
